package com.rd.student.jiaji.class3.caiyuxin.java8_8;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        //用户输入查询信息
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入查询的球员");
        String name=scanner.next();
        boolean run=false;
       //读取信息
        BufferedReader reader;
        reader=new BufferedReader(new FileReader("player.txt"));
        String line=reader.readLine();
        while (line!=null){
            //查询
            String[] play=line.split("，");
            for (String s: play){
                if (s.equals(name)){
                    run=true;
                    for (String a:play){
                        System.out.println(a);
                    }
                }
            }

            line=reader.readLine();
        }
        if (run==false){
            System.out.println("找不到此球员");
        }
        //关闭
        reader.close();

    }

}

